home *** CD-ROM | disk | FTP | other *** search
/ ...taking it to the Macs! / ...taking it to the Macs!.iso / Extras / ActiveX Mac SDK / ActiveX SDK / Container Common / pullstream.h < prev    next >
Text File  |  1997-01-03  |  3KB  |  91 lines

  1. //
  2. //  PullStream.H
  3. //
  4. //  Copyright (C) Microsoft Corporation, 1996
  5. //
  6.  
  7. #define STREAM_BUFFER_SIZE    8192
  8.  
  9.  
  10. class CPullStreamNotify:
  11.     public CNetscapeStreamNotify
  12. {
  13. public:
  14.     LPVOID    m_pStream;
  15.     long    m_StreamLength;
  16.     long    m_ReadyToRead;
  17.  
  18.     virtual ~CPullStreamNotify();
  19.     virtual int32 OnWriteReady(NPStream *stream);
  20.     virtual int32 OnWrite(NPStream *stream, int32 offset, int32 len, void
  21.         *buffer);
  22. };
  23.  
  24. class CPullOleStreamNotify:
  25.     public CPullStreamNotify,
  26.     public IStream
  27. {
  28. private:
  29.     ULONG m_cRef;
  30.  
  31. public:
  32.     long m_SeekPosition;
  33.     BOOL m_fAsyncStreamInProgress;
  34.  
  35.     inline CPullOleStreamNotify();
  36.  
  37.     //  *** IUnknown methods ***
  38.     STDMETHOD(QueryInterface)(REFIID riid, LPVOID *ppvObj);
  39.     STDMETHOD_(ULONG,AddRef)(void);
  40.     STDMETHOD_(ULONG,Release)(void);
  41.  
  42.     //  *** IStream methods ***
  43.     STDMETHOD(Read)(void *pv, DWORD cb, LPDWORD pcbRead);
  44.     STDMETHOD(Write)(void const *pv, DWORD cb, LPDWORD pcbWritten);
  45.     STDMETHOD(Seek)(LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition);
  46.     STDMETHOD(SetSize)(ULARGE_INTEGER libNewSize);
  47.     STDMETHOD(CopyTo)(LPSTREAM pstm, ULARGE_INTEGER cb, ULARGE_INTEGER *pcbRead, ULARGE_INTEGER *pcbWritten);
  48.     STDMETHOD(Commit)(DWORD grfCommitFlags);
  49.     STDMETHOD(Revert)(void);
  50.     STDMETHOD(LockRegion)(ULARGE_INTEGER libOffset, ULARGE_INTEGER cb,  DWORD dwLockType);
  51.     STDMETHOD(UnlockRegion)(ULARGE_INTEGER libOffset, ULARGE_INTEGER cb,  DWORD dwLockType);
  52.     STDMETHOD(Stat)(STATSTG *pstatstg, DWORD grfStatFlag);
  53.     STDMETHOD(Clone)(LPSTREAM *ppstm);
  54. };
  55.  
  56. inline
  57. CPullOleStreamNotify::CPullOleStreamNotify()
  58. {
  59.     //  Our implementation of the "new" operator will zero the structure so we
  60.     //  don't have to explicitly zero/null anything.
  61.     m_cRef = 1;
  62. }
  63.  
  64. class CBindingPullStreamNotify:
  65.     public CPullOleStreamNotify
  66. {
  67. private:
  68.     //  Back pointer to the binding object that created this stream.
  69.     CXBinding *m_pBinding;
  70.  
  71.     BOOL m_fDeliveredFirstNotify;
  72.  
  73. public:
  74.     inline CBindingPullStreamNotify(CXBinding *pBinding);
  75.  
  76.     virtual int32 OnWrite(NPStream *stream, int32 offset, int32 len, void
  77.         *buffer);
  78.     virtual NPError OnDestroyStream(NPStream *stream, NPError reason);
  79. };
  80.  
  81. inline
  82. CBindingPullStreamNotify::CBindingPullStreamNotify(CXBinding *pBinding)
  83. {
  84.     //  Our implementation of the "new" operator will zero the structure so we
  85.     //  don't have to explicitly zero/null anything.
  86.     m_pBinding = pBinding;
  87.     m_ReadyToRead = STREAM_BUFFER_SIZE;
  88. }
  89.  
  90.  
  91.